home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: Special XP & Vista
/
Chip Spesial XP & Vista.iso
/
3_Gadgets
/
Yahoo_Mail
/
YahooMail.gadget
/
js
/
gadget.js
Wrap
Text File
|
2007-11-27
|
5KB
|
168 lines
// JavaScript Document
///////////////////
/////SidebarGadgets.biz constants
//////////////////
var gSearchURL = new Array("http://mail.yahoo.com", "http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2F&tag=goldboxdeals-20&linkCode=ur2&camp=1789&creative=9325", "http://rover.ebay.com/rover/1/711-1751-2978-3/1?aid=5902069&pid=2552472", "http://rover.ebay.com/rover/1/710-5232-2978-16/1?aid=5048476&pid=2552472", "http://www.facebook.com", "http://www.joecartoon.com", "http://www.dpbolvw.net/click-2552472-10489289", "http://www.tkqlhce.com/click-2552472-10476826", "http://www.myspace.com/musicdownloadmusic", "http://www.dpbolvw.net/click-2552472-10386813", "http://www.anrdoezrs.net/click-2389807-10421372", "http://wikipedia.org", "http://www.youtube.com");
var gSearchName = new Array("Yahoo Mail", "Amazon", "eBay", "eBay UK", "Facebook", "Joe Cartoon", "Lavalife", "Metaboli", "Myspace", "Starbucks", "WestJet", "Wikipedia", "YouTube");
//var gSearchURL ="http://mail.yahoo.com";
//var gSearchURL = new Array("", "http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2F&tag=goldboxdeals-20&linkCode=ur2&camp=1789&creative=9325", "http://rover.ebay.com/rover/1/711-1751-2978-3/1?aid=5902069&pid=2552472", "", "", "", "", "", "", "");
//var gSearchName = new Array("Yahoo Mail", "Amazon", "eBay", "", "", "", "", "", "", "");
//sample
//http://www.sidebargadgets.biz
////////////////////////
//////Debug
/////////////////
function Debug(string)
{
System.Debug.outputString(string);
}
///////////////////////////////
// Handlers for gadget's events
//////////////////////////////
function SettingsClosed(event)
{
if (event.closeAction == event.Action.commit)
{
loadGadget();
}
}
function SettingsClosing(event)
{
if (event.closeAction == event.Action.commit)
{
SaveSettings();
}
else if (event.closeAction == event.Action.cancel)
{
}
event.cancel = false;
}
function CheckDockState()
{
if (System.Gadget.docked)
{
//set dock state
dockedState();
}
else
{
//set undock state
undockedState();
}
}
/////////////////////////////
///////Gadgets functions
//////////////////////////
//load gadget function
function loadGadget()
{
Start();
if (typeof (System) == 'undefined') return;
//attach to events
System.Gadget.onSettingsClosed = SettingsClosed;
System.Gadget.onDock = CheckDockState;
System.Gadget.onUndock = CheckDockState;
// System.Gadget.settingsUI = "settings.html";
}
//event undocked
function undockedState()
{
Debug("Undocked State");
}
//event docked
function dockedState()
{
Debug("docked State");
}
/////////////////////////////
/////Settings functions
///////////////////////////
//load settings function
function loadSettings()
{ Debug("Load settings");
if (typeof (System) == 'undefined') return;
System.Gadget.onSettingsClosing = SettingsClosing;
if (System.Gadget.Settings.read("first_time")=="")
{
Debug("1000");
gad_time.value = gDefaultTime;
}
else
{ Debug("00");
var gTime = System.Gadget.Settings.read("gad_time");
if (gTime == "") gad_time.value = gDefaultTime;
else gad_time.value = gTime;
}
}
//save settings function
function SaveSettings()
{
System.Gadget.Settings.write("gad_time", gad_time.value);
System.Gadget.Settings.write("first_time", "no");
}
///////////////////////
////Gadget custom code
///////////////////////
function Start()
{
var myselect = document.getElementById("engine");
var j=0;
for(var i=0; i<13; i++)
{
if(gSearchName[i]!="")
{
myselect.options[j] = new Option(gSearchName[i],i);
j++;
}
}
myselect.selectedIndex=0;
var myeng = document.getElementById("eng");
myeng.value=myselect.options[0].text;
}
function Search(keyword)
{
var myselect = document.getElementById("engine");
if(myselect.selectedIndex != -1)
{
//replace %keyword
var str=gSearchURL[myselect.options[myselect.selectedIndex].value].replace("%keyword%", document.getElementById("keyword").value);
// alert(str);
location.href=str;
}
}
function Show()
{
var mydiv = document.getElementById("select_box");
mydiv.style.display = (mydiv.style.display=='none')?'':'none';
return false;
}
function Select()
{
var myselect = document.getElementById("engine");
var myeng = document.getElementById("eng");
myeng.value=myselect.options[myselect.selectedIndex].text;
var mydiv = document.getElementById("select_box");
mydiv.style.display = 'none';
}
function handleKeyPress(e,form)
{
var key=e.keyCode || e.which;
if (key==13)
{
Search();
}
}